<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" @submit.prevent="">
      <el-row :gutter="8">
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="供应商类型" :labelWidth="120">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="统一社会代码" :labelWidth="120">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="联系人">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="联系电话">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="供应商编号" :labelWidth="120">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="供应商名称" :labelWidth="120">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="简称">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label="地址">
            <el-input clearable v-model.trim="form.createBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="4" :md="12" :sm="12" :xs="24">
          <el-form-item label-width="16px">
            <el-button type="primary" @click="search">查询</el-button>
            <el-button @click="reset">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </ele-card>
</template>

<script setup>
import { ref } from 'vue';
import { useFormData } from '@/utils/use-form-data';

const emit = defineEmits(['search']);



/** 日期范围 */
const dateRange = ref(['', '']);


/** 表单数据 */
const [form, resetFields] = useFormData({
  noticeTitle: '',
  createBy: '',
  noticeType: void 0
});

/** 搜索 */
const search = () => {
  const [d1, d2] = dateRange.value || [];
  emit('search', { ...form, params: { beginTime: d1, endTime: d2 } });

};

/** 重置 */
const reset = () => {
  resetFields();
  search();
};
</script>
